<h1>HORARIO POR DIA</h1>

<form action="<?php echo url_for('horario3/listarxdia'); ?>" method="post">
    <table>
    <tbody>
        <?php echo $formulario; ?>
    </tbody>
    </table>
<input type="submit" value="VER HORARIO" name="filtrar"/>
</form>
<br>

<?php $horario = array(); ?>
<?php $box = array(); ?>
<?php $data = array(); ?>

<?php //MATRIZ HORARIO VACIA ?>
<?php foreach ($gestdent_hora_list as $gestdent_hora): ?>
    <?php foreach ($gestdent_box_list as $gestdent_box): ?>
        <?php $data["Doctor"] = ""; ?>
        <?php $data["Color"] = ""; ?>
        <?php $box[$gestdent_box->getId()] = $data; ?>
        <?php $horario[$gestdent_hora->getId()] = $box; ?>
    <?php endforeach; ?>
<?php endforeach; ?>


<?php //LLENAMOS MATRIZ DE RESERVAS ?>
<?php foreach ($gestdent_horario3_list as $gestdent_horario3): ?>




    <?php //for ($i = $gestdent_horario->getHora() ; $i<= $gestdent_horario->getHoraTermino() ; $i ++ ) : ?>
        <?php //$horario[$i][$gestdent_horario->getBox()]["Doctor"] = $gestdent_horario->getGestdentPersonal()->getNombres()." ".$gestdent_horario->getGestdentPersonal()->getApellidoPaterno() ?>
    <?php //endfor; ?>

    <?php $detalle_list = $gestdent_horario3->getDetalle() ?>
    <?php foreach ($detalle_list as $detalle): ?>
        <?php $horario[$detalle->getHoraId()][$gestdent_horario3->getBoxId()]["Doctor"] .= $gestdent_horario3->getGestdentPersonal()->getNombres()." ".$gestdent_horario3->getGestdentPersonal()->getApellidoPaterno()."<br>" ?>
    <?php endforeach; ?>



<?php endforeach; ?>



<table>
    <thead
        <th><?php echo "Hora/Box" ?></th>
        <?php foreach ($gestdent_box_list as $gestdent_box): ?>
        <th><?php echo $gestdent_box->getNombre() ?></th>
        <?php endforeach; ?>
    </thead>

    <tbody>
        <?php foreach ($gestdent_hora_list as $gestdent_hora): ?>
        <tr>
            <td>
                <?php echo $gestdent_hora->getDescripcion() ?>
            </td>

            <?php foreach ($gestdent_box_list as $gestdent_box): ?>
            <td>
                <?php echo $horario[$gestdent_hora->getId()][$gestdent_box->getId()]["Doctor"]; ?>
            </td>
            <?php endforeach; ?>
        </tr>
        <?php endforeach; ?>
    </tbody>
</table>


<pre><?php //print_r ($gestdent_horario_list); ?></pre>
